#pragma once
#include "Rendering/Essentials/Vertex.h"

namespace SCION_CORE::ECS
{
  struct UVs
  {
    float u{0.f}, v{0.f}, uv_width{0.f}, uv_height{0.f};
  };

  struct SpriteComponent
  {
    float width{0.f}, height{0.f};
    UVs uvs{0.f, 0.f, 0.f, 0.f};
    SCION_RENDERING::Color color{255, 255, 255, 255};
    int start_x{0}, start_y{0}, layer{0};

    std::string texture_name{""};

    SpriteComponent(
        float w = 0.f,
        float h = 0.f,
        const SCION_RENDERING::Color &c = {255, 255, 255, 255},
        int sx = 0,
        int sy = 0, int layer = 0, std::string textname = "") : width(w), height(h), color(c), start_x(sx), start_y(sy), layer(layer), texture_name(textname)
    {
    }

    void generate_uvs(int textureWidth, int textureHeight)
    {
      uvs.uv_width = width / textureWidth;
      uvs.uv_height = height / textureHeight;
      uvs.u = start_x * uvs.uv_width;
      uvs.v = start_y * uvs.uv_height;
    }
  };
}